<template>
    <div class="contain"
         :class="{'collapse':isCollapse}">
        <div class="header">
            <!-- 顶部导航栏 -->
            <Top/>
        </div>

        <div class="layout">
            <div class="left">
                <!-- 左侧导航栏 -->
                <sidebar />
            </div>
            <div class="main">
                <!-- 顶部标签卡 -->
                <tags/>
                <!-- 主体视图层 -->
                <router-view/>
            </div>
        </div>
    </div>
</template>

<script>
import { mapGetters } from "vuex";
import Sidebar from "./sidebar";
import Top from "./top";
import Tags from "./tags";
export default {
  name: "index",
  data() {
    return {
      activeName: "second"
    };
  },
  components: {
    Top,
    Sidebar,
    Tags
  },
  computed: {
    ...mapGetters(["sidebar"]),
    isCollapse() {
      return this.sidebar.opened;
    }
  }
};
</script>

<style lang="scss" scoped>
.contain {
  width: 100%;
  height: 100%;
  background-color: #f2f2f2;
  background-size: 100%;
  background-repeat: no-repeat;
}
.header {
  padding-left: 220px;
  width: 100%;
  top: 0;
  background-color: #fff;
  box-sizing: border-box;
  transition: all 0.3s;
  border: 1px solid #ffffff;
}
.collapse {
  .left,
  .logo {
    width: 60px;
  }
  .header {
    padding-left: 60px;
  }
  .main {
    left: 60px;
    width: calc(100% - 60px);
  }
}
.left {
  position: fixed;
  left: 0;
  top: 0;
  width: 220px;
  height: 100%;
  z-index: 1025;
  transition: all 0.3s;
}
.main {
  transition: all 0.3s;
  position: absolute;
  left: 220px;
  margin-top: 5px;
  padding: 0;
  padding-bottom: 20px;
  width: calc(100% - 220px);
  height: calc(100% - 57px);
  box-sizing: border-box;
  overflow: hidden;
}
</style>
